
class Dog:
    number=0   #--类变量，所有对象可以调用
    def __init__(self,color,name):
        self.c=color
        self.n=name

    def dis_c(self):
        print("名字叫{}的狗是一条{}色的狗".format(self.n,self.c))

    @classmethod
    def class_method(cls):
        cls.number+=1

dog1=Dog('黄','旺财')
dog1.class_method()
print(dog1.number)
dog1.dis_c()

dog2=Dog("黑","来福")
dog2.class_method()
print(dog2.number)
dog2.dis_c()
